package net.lzzy.practices.entities;

import lombok.*;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.util.UUID;

/**
 * @author m
 */
//@Data
@NoArgsConstructor(access = AccessLevel.PROTECTED)//构造函数
//@Data //Set Get 方法

@MappedSuperclass  //指定为父类
public class BaseEntity {
    @Setter
    @Getter
    @Id //设计id为主键
    @GeneratedValue(generator = "uuid2") //生成策略
    @GenericGenerator(name="uuid2",strategy = "uuid2")//uuid 生成器
    /*
    * 定义数据库列的相关规范
    * columnDefinition ="BINARY(16)" 数据库 长度
    *
    * */
    @Column(columnDefinition ="BINARY(16)" ) //定义数据库列的相关规范,
    protected UUID id;


}
